home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource Library: Multimedia
/
Resource Library: Multimedia.iso
/
hypercrd
/
xcmds
/
dvlprstc.hqx
/
Developer Stack 1.3r
/
card_11574.txt
< prev
next >
Wrap
Text File
|
1991-04-30
|
2KB
|
110 lines
-- card: 11574 from stack: in.3r
-- bmap block id: 0
-- flags: 4000
-- background id: 3837
-- name: RenameFile
-- part 2 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=202 top=233 right=282 bottom=265
-- title width / last selected line: 0
-- icon id / first selected line: 27056 / 27056
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Try It
----- HyperTalk script -----
--
--12/15/87 ΓÇóΓÇóΓÇóSteve DrazgaΓÇóΓÇóΓÇó
--
--This script needs XFCNs 'FilenName' and 'RenameFile'
--It also needs the Hypertalk function 'LastPathComponent'
--It also needs the Hypertalk subroutine 'OsErr'
--
on mouseUp
if the optionkey is down then pass mouseup
put "Please select a file to rename"
put filename() into renamethis
if renamethis is empty then
hide message window
play oops
exit mouseup
end if
hide message window
put LastPathComponent(renamethis) into shortname
ask "What do you want to name this file" with shortname
if it is shortname or it is empty then
hide message window
play oops
exit mouseup
end if
put RenameFile(renamethis,it) into returnedthis
if returnedthis = 0 then
answer "Everything went just fine"
else
if returnedthis < 0 then
OsErr returnedthis
else
play oops
answer "Whoops, there was an error"
end if
end if
end mouseUp
-- part contents for background part 5
----- text -----
RenameFile
-- part contents for background part 10
----- text -----
8
-- part contents for background part 6
----- text -----
This will change the name of a file.
Thanks to:
Dewi Williams
2227 Juniper Court
Boulder CO 80302
(303) 443 9038
Delphi: DEWI
-- part contents for background part 7
----- text -----
Syntax:
RenameFile (<OldName>,<NewName>)
Returns either 0 (meaning a successful operation), 1 (meaning a parameter error), or a negative number (representing an operating system error).
"OldName" is a full pathname of the file that you want to rename.
"NewName" is a replacement for the last component of the path.
Do not put quotation marks around
"OldName" and "NewName"
You can use the OsErr* XCMD to interpret operating system errors.
-- part contents for background part 27
----- text -----
XFCN